home *** CD-ROM | disk | FTP | other *** search
- Path: Rezonet.net!news
- From: ray@ultimate-tech.com (Ray Dunn)
- Newsgroups: comp.lang.c
- Subject: Re: my atoi function, could someone suggest...
- Date: 14 Jan 1996 19:00:31 GMT
- Organization: Ultimate Technographics Inc.
- Message-ID: <4dbjsf$gmt@ns.RezoNet.NET>
- References: <4cf7ap$q4u@kaleka.seanet.com> <4cq937$if9@ns.RezoNet.NET> <4d6v51$qoh@gryphon.phoenix.net> <821573157snz@genesis.demon.co.uk>
- NNTP-Posting-Host: 204.19.230.7
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.7
-
- In referenced article, Lawrence Kirby says...
- > unsigned value = 0;
- > unsigned digit = *str - '0';
- >
- > if (digit < 10) {
- > value = digit;
-
- This is just a matter of personal style, but using the fact that an
- unsigned number minus a larger number results in a large unsigned
- number (so that "digit < 10" is false when *str is less than '0'), is
- rather obtuse IMO.
- --
- Ray Dunn (opinions are my own) | Phone: (514) 938 9050
- Montreal | Phax : (514) 938 5225
- ray@ultimate-tech.com | Home : (514) 630 3749
-
-